package daybook.model;

import java.math.BigDecimal;

public final class DC {
    private DC() {}
    public static final int DEBIT = 1;
    public static final int CREDIT = -1;

    public static boolean isDebit(BigDecimal amount, int normalBalance) {
        return getDc(amount, normalBalance) == DEBIT;
    }

    public static boolean isNormalBalance(BigDecimal amount, int normalBalance) {
        final int sign = amount.signum();
        return sign == 0 || sign == normalBalance;
    }

//    public static int getDc(BigDecimal amount) {
//        return getDc(amount, DEBIT);
//    }

    public static int getDc(BigDecimal amount, int normalBalance) {
        final int sign = amount.signum();
        return sign == 0 ? normalBalance : sign;
    }
}
